/*
 * Graph.h
 *
 *  Created on: 11 oct. 2011
 *      Author: amothe
 */

#ifndef GRAPH_H_
#define GRAPH_H_

#include <vector>
#include <iostream>
#include <string>

using namespace std;

class Graph {
protected:
	vector<vector<int> > _vertex_list;

public:
	Graph();
	Graph(vector<vector<int> > list);
	virtual ~Graph();

	vector<int>& operator[](int vertex);

	int getNbVertex() const;

	/* Add a vertex to the graph */
	int addVertex();

	void delVertex(int vertex);

	/* Add an edge between vertex and vertex2 */
	virtual void addEdge(int vertex, int vertex2);

	virtual void delEdge(int vertex1, int vertex2);

	/* Return the number of edge of the vertex */
	int numEdge(int vertex) const;

	/* Return if two vertices are linked */
	bool haveEdge(int vertex1, int vertex2);

	int getVertexNeighbour(int vertex, int index) const;

	vector<int> getNeighbours(int vertex) const;

	virtual string toString();
	Graph *copy() const;
};


class DirectedGraph : public Graph {
public :
	DirectedGraph(const Graph &,vector<int> covers);
};


#endif /* GRAPH_H_ */
